<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div></div>
    <p>
        文本
        <span>内容</span>
    </p>
    <script>
        //innerText和 innerHTML的区别
        // 1. innerText不识别html标签非标准去除空格和换行
        var div = document.querySelector('div');
        // div.innerText = '<strong>今天是: </strong> 2019 ';
        // 2. innerHTML识别html标签w3C标准保留空格和换行的
        div.innerHTML = '<strong>今天是:</strong>2019';
        //这两个属性是可读写的可以获取元素里面的内容
        var p = document.querySelector('p');
        console.log(p.innerText);
        console.log(p.innerHTML);
    </script>
</body>

</html>